import { createElement, HTMLAttributes, type FC } from 'react';
import classNames from 'classnames';
import { modalDescriptionDefaultProps } from './defaultProps';
import type { ModalDescriptionOptions } from './type';

export interface ModalDescriptionProps extends ModalDescriptionOptions, HTMLAttributes<HTMLDivElement> {}

const ModalDescription: FC<ModalDescriptionProps> = (props) => {
  const { className, ui, children, forwardedRef, ...modalDescriptionProps } = props;

  return createElement(
    'div',
    { ref: forwardedRef, className: classNames({ ui }, 'description', className), ...modalDescriptionProps },
    children,
  );
};

ModalDescription.displayName = 'ModalDescription';
ModalDescription.defaultProps = modalDescriptionDefaultProps;

export default ModalDescription;
